<?php

// 类  菜品
class Dish
{
  // 类的属性

  // id
  var $id;
  // 菜品名字
  var $name;
  // 价格
  var $price;
  // 菜品图片
  var $img;

  var $num = 0;

  // 构造函数
  function __construct($a, $b, $c)
  {
    // 函数  构造 参数 代码块
    $this->name = $a;
    $this->price = $b;
    $this->img = $c;
  }

  // 类里面的方法
  function addNum()
  {
    $this->num = $this->num + 1;
  }
}

$ddd = new Dish("红烧肉", 12, "./img/a.jpg");
// $ddd 就是 一个对象 他是菜品类的一个对象

$ddd->addNum();

var_export($ddd);

echo "<br/>";
echo $ddd->name;
echo "<br/>";

$oddd = get_object_vars($ddd);
var_export($oddd);
echo "<br/>";
echo $oddd['name'];
echo "<br/>";

// $_GET['name'];

echo "<br/>";

$a = true;
$b = false;

$ddd = null;

var_export($ddd);
echo "<br/>";
// [1,2,3,4,5]

$c = ['abc', '张三', '重庆', '德阳', '上海'];
//    0  1  2  3  4  下标



$ccc = ['a' => "阿斯顿马丁", 'b' => 2, 'c' => 3];



$d = "1231232sdfasdfas";

var_export($a);
echo "<br/>";
var_export($b);
echo "<br/>";
var_export($c);
echo "<br/>";

var_export($ccc);
echo "<br/>";
echo $ccc['a'];
echo "<br/>";
var_export($d);
echo "<br/>";
echo $c[2];
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  
</body>
</html>